import {createRouter, createWebHistory} from "vue-router";

const routes = [
    {
        path: "/",
        name: "/",
        redirect: "/pages", // 添加重定向规则
        // component: () => import("@/views/pages/index.vue"),
        children: [
            {
                path: "/pages",
                name: "pages",
                component: () => import("@/views/pages/index.vue"),
            },
            {
                path: "/conversation/:id",
                name: "conversation",
                component: () => import("@/views/conversation/index.vue"),
            },
            {
                path: "/setting",
                name: "setting",
                component: () => import("@/views/setting/index.vue"),
            },
        ],
    },
];

const router = createRouter({
    history: createWebHistory(), // 使用历史模式
    routes, // （缩写）相当于 routes: routes
});

export default router;
